/*
    Project:        Home Power Control
    File:           HPCButton.cpp
    Author:         christian@karunamusic.at
    Date:           01.2015
    Description:    Simple class to cover a button.
 */

#include <wiringPi.h>
#include <Logger/HPCLogger.h>
#include "HPCButton.h"

HPCButton::HPCButton(const QString& name, quint32 id, quint8 pin )
    : HPCSensor(TSensorType::HPCButton,name,id,pin)
{
}

HPCButton::~HPCButton()
{
}

void HPCButton::Measure()
{
    HPCValue res;
    res.V() = (digitalRead(m_Pin) == 1);
    LOG( trace, Name() << ": measured value: " << res.V().toBool() );
    m_Value = res;
}
